import { defHttp } from '/@/utils/http/axios';
import { IGetSupplierCheckNumberIsExistQuery } from '/@/types/system/basic/supplier/checkNumberIsExist';
import {
  IPostSupplierListRequest,
  IPostSupplierListResponse,
} from '/@/types/system/basic/supplier/list';
import { IGetRawSupplierDetailsResponse } from '/@/types/system/basic/supplier/details';
import { IPostSupplierUpdateRaw } from '/@/types/system/basic/supplier/update';
import { IPostSupplierDeleteRequest } from '/@/types/system/basic/supplier/delete';
import { IPostSupplierAddRequest } from '/@/types/system/basic/supplier/add';

/**
 * /system/basic/supplier/checkNumberIsExist
 */
export const apiGetSupplierCheckNumberIsExistQuery = (
  params: IGetSupplierCheckNumberIsExistQuery,
) =>
  defHttp.get(
    { url: `/system/basic/supplier/checkNumberIsExist`, params },
    { joinParamsToUrl: true },
  );
/**
 * 供应商列表
 */
export const apiPostSupplierList = (params: IPostSupplierListRequest) =>
  defHttp.post<IPostSupplierListResponse>({ url: `/system/basic/supplier/list`, params });
/**
 * 供应商详情
 */
export const apiGetSupplierDetailsPath = (id: string | number) =>
  defHttp.get<IGetRawSupplierDetailsResponse>({ url: `/system/basic/supplier/details/${id}` });
/**
 * 修改供应商信息
 */
export const apiPostSupplierUpdatePath = (id: string | number, params: IPostSupplierUpdateRaw) =>
  defHttp.post({ url: `/system/basic/supplier/update/${id}`, params });
/**
 * 删除供应商
 */
export const apiPostSupplierDelete = (params: IPostSupplierDeleteRequest) =>
  defHttp.post({ url: `/system/basic/supplier/delete`, params });
/**
 * 新增供应商信息
 */
export const apiPostSupplierAdd = (params: IPostSupplierAddRequest) =>
  defHttp.post({ url: `/system/basic/supplier/add`, params });
